package com.liuxin.zhiyuan.shujuzhongxin.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.liuxin.zhiyuan.shujuzhongxin.domain.po.MajorSubjectEntity;
import com.liuxin.zhiyuan.shujuzhongxin.service.MajorSubjectService;
import com.liuxin.common.utils.PageUtils;
import com.liuxin.common.utils.R;



/**
 * 学科信息表
 *
 * @author zsl
 * @email 1301966496@qq.com
 * @date 2025-10-14 23:09:01
 */
@RestController
@RequestMapping("shujuzhongxin/majorsubject")
public class MajorSubjectController {
    @Autowired
    private MajorSubjectService majorSubjectService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("shujuzhongxin:majorsubject:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = majorSubjectService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info")
    //@RequiresPermissions("shujuzhongxin:majorsubject:info")
    public R info(@RequestParam("id") Integer id){
		MajorSubjectEntity majorSubject = majorSubjectService.getById(id);

        return R.ok().put("majorSubject", majorSubject);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("shujuzhongxin:majorsubject:save")
    public R save(@RequestBody MajorSubjectEntity majorSubject){
		majorSubjectService.save(majorSubject);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
   //@RequiresPermissions("shujuzhongxin:majorsubject:update")
    public R update(@RequestBody MajorSubjectEntity majorSubject){
		majorSubjectService.updateById(majorSubject);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("shujuzhongxin:majorsubject:delete")
    public R delete(@RequestBody Integer[] ids){
		majorSubjectService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
